package dongshi.daddy.command.v2;

import dongshi.daddy.command.v2.command.*;
import dongshi.daddy.command.v2.invoker.MyInvoker;
import dongshi.daddy.command.v2.receiver.AirConditionerReceiver;
import dongshi.daddy.command.v2.receiver.XiaoAiTongXueReceiver;

public class V2Test {
    public static void main(String[] args) {
        // 创建具体命令的执行者们
        AirConditionerReceiver airConditionerReceiver
                = new AirConditionerReceiver();
        XiaoAiTongXueReceiver xiaoAiTongXueReceiver = new XiaoAiTongXueReceiver();

        // 创建命令
        Command singCommand = new SingCommand(xiaoAiTongXueReceiver);
        Command jokeCommand = new JokeCommand(xiaoAiTongXueReceiver);
        Command coldCommand = new ColdCommand(airConditionerReceiver);
        Command hotCommand = new HotCommand(airConditionerReceiver);

        // 把命令添加到invoker
        MyInvoker myInvoker = new MyInvoker();
        myInvoker.addCommand(singCommand);
        myInvoker.addCommand(jokeCommand);
        myInvoker.addCommand(hotCommand);
        myInvoker.addCommand(coldCommand);

        // 执行命令
        myInvoker.execCommand();
    }
}